package jym.tan.movielibrary.component.ui.panel;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;

public abstract class GradientBackgroundPanel<E> extends ScrollablePanel<E> {

	private static final long serialVersionUID = 55L;

	private Color top;
	private Color bottom;

	public GradientBackgroundPanel(Color top, Color bottom) {
		super();
		this.top = top;
		this.bottom = bottom;
	}

	@Override
	protected void paintComponent(Graphics graphics) {
		super.paintComponent(graphics);
		Graphics2D graphics2d = (Graphics2D) graphics;
		GradientPaint gradPaint = new GradientPaint(0, 0, top, 0, getHeight(), bottom);
		graphics2d.setPaint(gradPaint);
		graphics2d.fillRect(0, 0, getWidth(), getHeight());
	}
}
